﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ERepair.aspx.cs" Inherits="Catering.Catering_Page.yl.Daily.ERepair" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>设备维修</title>
    <script src="../../../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script src="../../../Scripts/zhezhao.js" type="text/javascript"></script>
    <link href="../../../Style/ZHJG/zhezhao.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../../../Style/head_2.css" />
    <link rel="stylesheet" type="text/css" href="../../../Style/center.css" />   
    <script language="javascript" type="text/javascript" src="../../../Scripts/My97DatePicker/WdatePicker.js"></script>
    <style type="text/css">
        .bander{width:998px; border:1px solid #C2DEF6; background-color:#E5F1FD; height:34px; margin:10px auto 10px; line-height:34px;}
        .rbtj_report{text-align:center; clear:both;}
        .rbtj_report h1{ font-size:16px; margin:5px auto 10px;}
        .auto-style1 {
            width: 165px;
        }
        </style>
    <script type="text/javascript">
        //显示添加
        function EAdd() {
            $("#txt_EName").val("");
            $("#txt_EType").val("");
            $("#txt_ESource").val("");
            $("#txt_EPerson").val("");
            $("#txt_ERemark").val("");
            $("#btnEEdit").hide();
            $("#btnEAdd").show();
            divshow("Emain", "bg");

        }
        //添加数据
        function btn_EAdd() {
            var txt_EName = $("#txt_EName").val();
            if (txt_EName == "") {
                alert("设备名称为空！");
                return;
            }
            var txt_EType = $("#txt_EType").val();            
            var txt_ESource = $("#txt_ESource").val();            
            var txt_EPerson = $("#txt_EPerson").val();            
            var txt_ERemark = $("#txt_ERemark").val();            
            var sel = document.getElementById("Drop_ZuoYeQu");
            var Drop_ZuoYeQu = sel.options[sel.selectedIndex].value;
            sel = document.getElementById("Drop_BanZu");
            var Drop_BanZu = sel.options[sel.selectedIndex].value;            
            <%  string ddl_Mtc_val = "";
                if (ddl_Mtc.Items.Count != 0)
                    ddl_Mtc_val = ddl_Mtc.SelectedValue;                
            %>
            var ddl_Mtc = '<%=ddl_Mtc_val%>';
            if (ddl_Mtc == "") {
                alert("承包商为空，请添加！");
                return;
            }

            var txt_date = $("#txt_date").val();
            $.ajax(
                {
                    type: "Post",
                    url: "ERepair.aspx/EAdd",
                    data: "{'EquipCName':'" + txt_EName + "','EquipModel':'" + txt_EType + "','BrandArea':'" + txt_ESource + "','UserCName':'" + txt_EPerson + "','ConDesc':'" + txt_ERemark + "','Drop_ZuoYeQu':'" + Drop_ZuoYeQu + "','Drop_BanZu':'" + Drop_BanZu + "','ddl_Mtc':'" + ddl_Mtc + "','txt_date':'" + txt_date + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",

                    success: function (data) {
                        if (data.d == "OK") {
                            alert("保存成功！");
                            window.location.href = window.location.href;
                        }
                    }
                });
        }
        //显示修改
        function EEdit(cid) {
            $("#HidEID").val(cid);

            $.ajax({
                type: "Post",
                url: "ERepair.aspx/EGet",
                data: "{'_id':'" + cid + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    $("#txt_Eid").val(data.d[0] == null ? "" : data.d[0]);
                    $("#txt_EName").val(data.d[1] == null ? "" : data.d[1]);
                    $("#txt_EType").val(data.d[2] == null ? "" : data.d[2]);
                    $("#txt_ESource").val(data.d[3] == null ? "" : data.d[3]);
                    $("#txt_EPerson").val(data.d[5] == null ? "" : data.d[5]);
                    $("#txt_ERemark").val(data.d[4] == null ? "" : data.d[4]);

                    $("#btnEEdit").show();
                    $("#btnEAdd").hide();
                    divshow("Emain", "bg");
                }
            });
        }
        function btn_EEdit() {
            var txt_EName = $("#txt_EName").val();
            var txt_EType = $("#txt_EType").val();
            var txt_ESource = $("#txt_ESource").val();
            var txt_EPerson = $("#txt_EPerson").val();
            var txt_ERemark = $("#txt_ERemark").val();
            var cid = $("#txt_Eid").val();
            var sel = document.getElementById("Drop_ZuoYeQu");
            var Drop_ZuoYeQu = sel.options[sel.selectedIndex].value;
            sel = document.getElementById("Drop_BanZu");
            var Drop_BanZu = sel.options[sel.selectedIndex].value;
            sel = document.getElementById("ddl_Mtc");
            var ddl_Mtc = sel.options[sel.selectedIndex].value;
            var txt_date = $("#txt_date").val();

            $.ajax({
                type: "Post",
                url: "ERepair.aspx/EEdit",
                data: "{'_id':'" + cid + "','EquipCName':'" + txt_EName + "','EquipModel':'" + txt_EType + "','BrandArea':'" + txt_ESource + "','UserCName':'" + txt_EPerson + "','ConDesc':'" + txt_ERemark + "','Drop_ZuoYeQu':'" + Drop_ZuoYeQu + "','Drop_BanZu':'" + Drop_BanZu + "','ddl_Mtc':'" + ddl_Mtc + "','txt_date':'" + txt_date + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("保存成功！");
                        window.location.href = window.location.href;
                        //window.location.href = 'ERepair.aspx';
                    }
                }
            });
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="xxk_button1">
        <ul>
            <li id="li4_1" class="li_out"><a href="../../richang/rbgl.aspx">填写日报</a> </li>
            <li id="li4_2" class="li_out"><a href="../../richang/rbtj.aspx">日报统计</a> </li>
            <li id="li4_3" class="li_out li_over"><a href="ERepair.aspx">设备报修</a> </li>
            <li id="li4_4" class="li_out"><a href="SppPlan.aspx">配件采购计划</a> </li>
        </ul>
       </div>
        <asp:HiddenField ID="HidEID" runat="server" />       
            <div style="margin-top:5px;width: 100%;height: 30px;line-height: 30px;padding: 5px 0px;border: 1px solid #c2def6;background-color: #e5f1ff;margin-top: 10px; width:998px;margin:auto">
            <table width="100%" border="0" cellpadding="0" cellspacing="0" style=" width:998px;margin:auto">
                <tr style="text-align:right">
                    <td style="width:50px">作业区:</td>
                    <td style="width:120px"><asp:DropDownList ID="Drop_ZuoYeQu" runat="server" AutoPostBack="True" CssClass="select_input_bg" Width="120px" OnSelectedIndexChanged="Drop_ZuoYeQu_SelectedIndexChanged"></asp:DropDownList></td>
                    <td style="width:50px">班组:</td>
                    <td style="width:120px"><asp:DropDownList ID="Drop_BanZu" runat="server" AutoPostBack="True" CssClass="select_input_bg" Width="120px" OnSelectedIndexChanged="Drop_BanZu_SelectedIndexChanged"></asp:DropDownList></td> 
                    <td style="width:50px">承包商:</td> 
                    <td style="width:120px"><asp:DropDownList ID="ddl_Mtc" runat="server" AutoPostBack="True" CssClass="select_input_bg" Width="120px" OnSelectedIndexChanged="ddl_Mtc_SelectedIndexChanged"></asp:DropDownList></td>                    
                    <td style="width:80px">添加时间:</td> 
                    <td style="width:100px"><asp:TextBox ID="txt_date" runat="server" Width="100px"></asp:TextBox></td> 
                    <td align="right" height="30">
                        <input type="button" class="input_btn_a" value="添加" onclick="EAdd()"/>
                    </td>
                    <td width="10"></td>
                </tr>
            </table>
        </div>
        <div style="padding: 0px;text-align: center;height: 29px;">
            <table cellpadding="0" cellspacing="0" width="100%" style="border-top:1px solid #8b8888;border-left:1px solid #8b8888; width:998px;margin:auto; font-size:12px">
                <thead>
                    <tr style="background:url(../../../Images/th_02bg.gif) repeat-x 0px 0px; height:29px;">
                        <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888;width:50px" >序号
                        </td >
                        <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888;width:100px">设备名称
                        </td>
                        <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888;width:100px">设备型号
                        </td>
                        <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888;width:100px">品牌产地
                        </td>
                        <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888;">设备故障具体描述
                        </td>
                        <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888;width:80px">报修人
                        </td>
                        <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888;width:50px">操作
                        </td>                        
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="Rep_EPlan" runat="server" OnItemCommand="Rep_EPlan_ItemCommand">
                        <ItemTemplate>
                            <tr>
                                <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888">
                                    <%#Eval("tempId")%>                                    
                                </td>
                                <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888">
                                    <%#Eval("EquipCName")%>
                                </td>
                                <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888">
                                    <%#Eval("EquipModel")%>
                                </td>
                                <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888">
                                    <%#Eval("BrandArea")%>
                                </td>
                                <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888">
                                    <%#Eval("ConDesc")%>
                                </td>
                                <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888">
                                    <%#Eval("UserCName")%>
                                </td>
                                <td style="border-right:1px solid #8b8888;border-bottom:1px solid #8b8888">
                                    <img alt="" title="编辑" src="../../../Images/file.gif" style="cursor: pointer;" onclick="EEdit('<%#Eval("id")%>')"/>
                                    <asp:ImageButton ToolTip="删除" ID="ImageButton1" runat="server" ImageUrl="../../../Images/trash.gif" OnClientClick="return confirm('确认删除？');"
                                        CommandArgument='<%#Eval("id")%>' CommandName="Edel"/>
                                </td>                                
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
            </div>
        <div id="bg" class="bg">
        </div>
        <div id="Emain" class="center_div" style="width: 450px; height: 250px; margin:auto;left:25%;top:10%;">
            <div class="div_0207" style="width: 448px; height: 100%; margin: 0px;">
                <h1>
                    <img src="../../../Images/cp_h1_03.gif" />添加设备故障</h1>
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="80" height="30">设备名称：
                        </td>
                        <td width="110"> 
                            <asp:HiddenField ID="txt_Eid" runat="server" />                              
                            <asp:TextBox ID="txt_EName" runat="server" CssClass="input_bg" Width="105"></asp:TextBox>
                        </td>
                        <td width="80" height="30" align="right">设备型号：
                        </td>
                        <td width="110"> 
                            <asp:TextBox ID="txt_EType" runat="server" CssClass="input_bg" Width="105"></asp:TextBox> 
                        </td>
                    </tr>
                    <tr>
                        <td width="80" height="30">品牌产地：
                        </td>
                        <td width="110">                            
                            <asp:TextBox ID="txt_ESource" runat="server" CssClass="input_bg" Width="105"></asp:TextBox>
                        </td>
                        <td width="80" align="right">报修人：
                        </td>
                        <td width="110">                            
                            <asp:TextBox ID="txt_EPerson" runat="server" CssClass="input_bg" Width="105"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td>故障描述：
                        </td>
                        <td colspan="3" style="text-align:left">
                            <asp:TextBox ID="txt_ERemark" runat="server" TextMode="MultiLine" CssClass="input_bg"
                                Style="width: 330px; height: 40px;"></asp:TextBox>
                        </td>
                    </tr>
                </table>
                <table width="100%">
                    <tr>
                        <td height="30" align="right">
                            <input type="button" id="btnEAdd" onclick="btn_EAdd()" class="input_btn_a" value="提交" />
                            <input type="button" id="btnEEdit" onclick="btn_EEdit()" class="input_btn_a" value="提交" />
                        </td>
                        <td>
                            <input type="button" id="but_EClose" onclick='divhidel("Emain", "bg")' class="input_btn_a"
                                value="关闭" />
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </form>
</body>
</html>
